<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property int $channel_code_id 渠道活码ID
 * @property string $qr_code_cfg 二维码设置
 * @property int $display_mode 显示方式(0 = 显示已加成员二维码，1 = 跳转链接)
 * @property string $display_cfg 显示配置
 * @property array $page_cfg 页面样式设置
 * @property string $code 活码
 * @property string $created_at 创建时间
 * @property-read null|ChChannelCode $channelCode 
 */
class ChLockCustomerCode extends MineModel
{
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_lock_customer_code';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'channel_code_id', 'qr_code_cfg', 'display_mode', 'display_cfg', 'page_cfg', 'code', 'created_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'channel_code_id' => 'integer', 'display_mode' => 'integer', 'page_cfg' => 'array'];

    public function channelCode()
    {
        return $this->belongsTo(ChChannelCode::class, 'channel_code_id');
    }
}
